<include file="Admin@Public/header" /> 

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <ol class="breadcrumb">
      <li>网站内容</li>
      <li>幻灯片</li>
      <li class="active">编辑</li>
    </ol>
     
    <form  class="form-horizontal" role="form" action="__URL__/save" >
      <input type="hidden" name="inputId" value="{$slide.id}" > 

      <div class="form-group">
        <label for="inputTitle" class="col-sm-2 control-label">标题 </label>
        <div class="col-sm-5">
          <input type="text" class="form-control" id="inputTitle" name="inputTitle" placeholder="请输入幻灯片标题" datatype="*1-60" errormsg="<i class='icon-warning-sign'></i> 标题在1~60位之间"  nullmsg="<i class='icon-warning-sign'></i> 请填写信息！" value="{$slide.title}" >
        </div>
        <div class="Validform_checktip">
           <div class="Validform-info">标题至少1个字符,最多60个字符<span class="dec"><s class="dec1">&#9670;</s><s class="dec2">&#9670;</s></span></div>
        </div>
      </div>
      <div class="form-group">
        <label for="inputUrl" class="col-sm-2 control-label">链接 </label>
        <div class="col-sm-5">
          <textarea class="form-control" id="inputUrl" name="inputUrl" placeholder="请输入幻灯片链接地址 hppt://www." datatype="*0-120" errormsg="<i class='icon-warning-sign'></i> 分类名在0~120位之间"  nullmsg="<i class='icon-warning-sign'></i> 请填写信息！" >{$slide.url}</textarea>
        </div>
        <div class="Validform_checktip">
           <div class="Validform-info">文章描述最多120个字符<span class="dec"><s class="dec1">&#9670;</s><s class="dec2">&#9670;</s></span></div>
        </div>
      </div>
      <div class="form-group">
        <label for="inputDescription" class="col-sm-2 control-label">简述 </label>
        <div class="col-sm-5">
          <textarea class="form-control" id="inputDescription" name="inputDescription" placeholder="请输入幻灯片简述" datatype="*0-120" errormsg="<i class='icon-warning-sign'></i> 幻灯片简述在0~120位之间"  nullmsg="<i class='icon-warning-sign'></i> 请填写信息！" >{$slide.description}</textarea>
        </div>
        <div class="Validform_checktip">
           <div class="Validform-info">幻灯片简述最多120个字符<span class="dec"><s class="dec1">&#9670;</s><s class="dec2">&#9670;</s></span></div>
        </div>
      </div>
      <div class="form-group">
        <label for="file_upload" class="col-sm-2 control-label">图片 </label>
        <div class="col-sm-3">
          <input type="file" name="file_upload" id="file_upload">
        </div>
        <div class="col-sm-4">
          图片格式为 'jpg','jpeg','gif','png',大小：1140*440 
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label"> </label>
        <div class="col-sm-5">
          <div class="table-responsive">
             <table class="table">
                <thead>
                  <tr><th>图片</th></tr>
                </thead>
                <tbody id="imageList">
                  <tr>
                  <td><input type="hidden" name="inputImageId[]" value="{$slide.imageid}"><img src="<?php echo (C("IMAGE_ROOTPATH"));?>{$slide.imageid|imageSrc=###}" width="100%"></td>
                </tr>
                </tbody>
              </table>
          </div>  
        </div>
      </div>
      <div class="form-group">
        <label for="inputStatus" class="col-sm-2 control-label">是否显示</label>
        <div class="col-sm-4">
          <input type="checkbox" name="inputStatus" value="1" id="inputStatus" <if condition="$slide[status] == 1"> checked</if>> 显示
        </div>
      </div>

      <div class="form-group">
        <label  class="col-sm-2 control-label"> </label>
        <div class="col-sm-4">
          <input type="button" class="btn btn-primary" value="编辑" id="btn_sub"/>
           <a href="__URL__/index" class="btn btn-default" >返回</a>
      </div>
    </div>
    </form> 
            
            
</div>
<script type="text/javascript">
    <?php $timestamp = time();?>
    $(function() {
      $('#file_upload').uploadify({
          'formData'     : {
            'timestamp' : '<?php echo $timestamp;?>',
            'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
            },
          'multi'    : false,
          'buttonText':"选择文件",
          'swf'      : '__PUBLIC__/uploadify/uploadify.swf',
          'uploader' : '/Plugin/Upload/upload',
          'onUploadSuccess' : function(file, data, response) {
            var data = eval( '(' + data + ')' ); //json：存在json数组和json实体
              if (data.status) {
                 var imageListStr = putImageList(data.imageId,data.imageSrc,data.imageAlt);
                 $('#imageList').html(imageListStr);
              };
          }
      });
    });
    function putImageList(imageId,imageSrc,imageAlt){
        var imageSrcRoot='<?php echo (C("IMAGE_ROOTPATH"));?>';
        imageSrc=imageSrcRoot+imageSrc;
        var imageListStr="<tr><td><input type='hidden' name='inputImageId' value='"+imageId+"'><img src='"+imageSrc+"' width='100%'></td></tr>";
        return imageListStr;
    }
</script>
<include file="Admin@Public/script_form" /> 
<include file="Admin@Public/footer" /> 
   
